<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <#include "../common/header.ftl">
    <style type="text/css">
        #TravelModal img{
            width:100%;
        }
        #TravelModal .modal-body{
            max-height:500px;
            overflow-y:auto;
        }
    </style>
</head>
<body>

<div class="container " style="margin-top: 20px">
    <#include "../common/top.ftl"/>
    <div class="row">
        <div class="col-sm-3">
            <!--设置当前要回显当前菜单,必须在载人菜单前完成设置-->
            <#assign menu="travel"/>
            <#include "../common/menu.ftl"/>
        </div>
        <div class="col-sm-9">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">待审核游记管理</h1>
                </div>
            </div>
            <!--高级查询--->
            <form class="form-inline" id="searchForm" action="/travel/list.do" method="post">
                <input type="hidden" id="currentPage" name="currentPage" value="1">
                <div class="form-group">
                    <label>关键字:</label>
                    <input type="text" class="form-control" name="keyword" value="${(qo.keyword)!}"
                           placeholder="请输入标题">
                </div>
                <button type="submit" class="btn btn-success">
                    <span class="glyphicon glyphicon-search"></span> 查询
                </button>
            </form>

            <table class="table table-striped table-hover">
                <tr>
                    <th>标题</th>
                    <th>封面</th>
                    <th>地点</th>
                    <th>作者</th>
                    <th>状态</th>
                    <th colspan="3">操作</th>
                </tr>
                <#list result.list as entity>
                <tr>
                    <td>${entity.title!}</td>
                    <td><img src="${entity.coverUrl!}" width="40px"/></td>
                    <td>${(entity.place.name)!}</td>
                    <td>${(entity.author.nickName)!}</td>
                    <td>${entity.stateName!}</td>
                    <td><a href="javascript:;" data-id="${entity.id}" data-state="3" class="changeState">发布</a></td>
                    <td><a href="javascript:;" data-id="${entity.id}" data-state="0" class="changeState">拒绝</a></td>
                    <td><a href="javascript:;" data-id="${entity.id}" class="showTravel">查看文章</a></td>

                </tr>
                </#list>
            </table>
           <#include "../common/page.ftl">
        </div>
    </div>
</div>

<div class="modal fade" id="TravelModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">查看游记</h4>
            </div>
            <div class="modal-body">

            </div>
        </div>
    </div>
</div>


<script>
    $(".changeState").click(function () {
        var id = $(this).data("id");
        var state = $(this).data("state");
        $.get("/travel/changeState.do", {"id": id, "state": state}, function (data) {
            if (data.success) {
                reload();
            } else {
                $.messager.alert("提示", data.msg)
            }
        }, "json");
    });

    $(".showTravel").click(function () {
        var id = $(this).data("id");
        $.get("/travel/selectOne.do", {id: id}, function (data) {
                $("#TravelModal .modal-body").html(data.content);
        }, "json")
        $("#TravelModal").modal("show");
    });
</script>

</body>
</html>